<?php
/**
 * 员工任岗信息
 * Created by PhpStorm.
 * User: echa
 * Date: 2018/3/8
 * Time: 13:54
 */

namespace App\Http\Controllers\WarehouseManage;
use App\Http\Controllers\ApiController;
use App\Services\Warehouse\EmployeePostService;
use Illuminate\Http\Request;

class EmployeePostController extends ApiController{
    protected $EmployeePostService;
    public function __construct(EmployeePostService $employeePostService)
    {
        $this->EmployeePostService=$employeePostService;
    }

    /**
    *   获取员工任岗列表
     */
    public function GetEmployeePostList(){
        $list=$this->EmployeePostService->ListEmployeePost();
        return $list;
    }

    /**
    *   根据员工编号和任岗编号条件，查询相关数据
     */
    public function GetEmployeePostInfo(Request $request){
        $FStaffNumber=$request->employees_num;
        $FPositionNumber=$request->jobs_num;
        $info=$this->EmployeePostService->ListEmployeePost($FStaffNumber,$FPositionNumber);
        return $info;
    }

    /**
    *   创建员工任岗信息
     */
    public function SaveEmployeePost(Request $request){
        $FStaffNumber=$request->employees_num;
        $FDeptNumber=$request->k3_departments;
        $FJobsNumber=$request->k3_jobs;
        $savadata=[
            'FStaffNumber'=>$FStaffNumber,
            'FDeptNumber'=>$FDeptNumber,
            'FJobsNumber'=>$FJobsNumber
        ];
        $id=$this->EmployeePostService->SaveEmployeePost($savadata);
        return $id;
    }
}